package zhihui.mobile.ui.express;

import android.app.Activity;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import zhihui.mobile.R;
import zhihui.mobile.bean.express.ExpressHistoryBeanListV2;

/**
 * Created by Administrator on 2017/5/6 0006.
 */

public class ExpressHistoryGetAdapter extends BaseQuickAdapter<ExpressHistoryBeanListV2.DataBean.ListBean, BaseViewHolder> {

    private Activity context;

    public ExpressHistoryGetAdapter(List data, Activity context) {
        super(R.layout.item_express_get_history, data);
        this.context = context;
    }

    @Override
    protected void convert(final BaseViewHolder helper, ExpressHistoryBeanListV2.DataBean.ListBean item) {
        switch (item.getType_f()) {
            case 1:
                helper.setVisible(R.id.item_express_histroy_get_layout, true);
                helper.setVisible(R.id.item_express_histroy_send_layout, false);
                helper.setText(R.id.item_express_histroy_name_tv, "包裹源：" + item.getEname_f());
                helper.setText(R.id.item_express_histroy_id_tv, "快递单号：" + item.getOrdersn_f());
                helper.setText(R.id.item_express_histroy_time_tv, "入库时间：" + item.getTime_f());
                helper.setText(R.id.item_express_histroy_getcode_tv, "取件码：" + item.getNo_f());
                switch (item.getMethod_f()) {
                    case 1:
                        helper.setText(R.id.item_express_histroy_getway_tv, "提货方式：用户自提");
                        break;
                    case 2:
                        helper.setText(R.id.item_express_histroy_getway_tv, "提货方式：送货到家");
                        break;
                }

                break;
            case 2:
                helper.setVisible(R.id.item_express_histroy_get_layout, false);
                helper.setVisible(R.id.item_express_histroy_send_layout, true);
                helper.setText(R.id.item_express_histroy_name_send_tv, "包裹源：" + item.getEname_f());
                helper.setText(R.id.item_express_histroy_id_send_tv, "快递单号：" + item.getOrdersn_f());
                helper.setText(R.id.item_express_histroy_time_send_tv, "寄件时间：" + item.getTime_f());
                helper.setText(R.id.item_express_histroy_paynum_tv, "快递费用：" + Double.parseDouble(item.getMoney_f()) / 100);
                helper.setText(R.id.item_express_histroy_username_tv, "收货人：" + item.getUname_f());
                helper.setText(R.id.item_express_histroy_phone_tv, "联系电话：" + item.getUtel_f());
                helper.setText(R.id.item_express_histroy_address_tv, "收货地址：" + item.getUaddress_f());
                break;
        }


    }
}
